%!TEX program = xelatex
% basesty.sty


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Basic
% \cmd
%   \command-name [optional-params]{required-params}
%   \command-name [arg1, arg2]{}            -> arg1, arg2顺序不可互换
%   \command-name [arg1][arg2]{}            -> arg1, arg2顺序不可互换
%   \command-name [arg1=val1, arg2=val2]{}  -> arg1, arg2顺序可互换

\ProvidesPackage{basesty.sty}[2020/07/19]

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 排版设置
\RequirePackage{
    geometry, % 页面布局
    changepage, % 页面设置
    setspace, % 间距调整
    hyperref, % 目录超链接
    tocbibind, % 生成PDF目录页书签
    xcolor, % 颜色包
}
\geometry{
    top=2cm,
    bottom=2cm,
    left=2cm,
    right=2cm,
    centering,
}
\setstretch{1.5} % 行距设置
\hypersetup{
    bookmarks=true, % PDF书签
    bookmarksnumbered=true, % PDF书签章节编号
    colorlinks=true, % true:使用颜色链接，false:使用方框链接
    linkcolor=purple!80!white,
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 字体
\RequirePackage{ctex}
\setmainfont{Noto Serif} % 英文衬线字体（默认字体）
\setsansfont{Noto Sans} % 英文无衬线字体
\setmonofont{Noto Sans Mono} % 英文等宽字体
\setCJKmainfont{Noto Serif CJK SC} % 中文衬线字体（默认字体），如 SimSun(宋体) NSimSun(新宋体) FangSong(仿宋)
\setCJKsansfont{Noto Sans CJK SC} % 中文无衬线字体，SimHei(黑体) YouYuan(幼圆)
\setCJKmonofont{Noto Sans Mono CJK SC} % 中文等宽字体，如 Microsoft YaHei(微软雅黑)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 表
\RequirePackage{
    makecell, % 单元格
    multirow, % 多行表格
    booktabs, % 表格水平线
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 图
% tikz基本结构：path, node, tree, graph
%   \path (point) <action> (point) <action> ...
%   path绘图像一支笔，在一系列point上顺序移动，并画下action
%       point:
%           直角坐标(1cm,2pt)
%           极坐标(30:1cm)
%           相对坐标+(1,0) ++(50:10)
%           坐标计算($(...)$)
%       action:
%           笔：\path[draw, params] = \draw [params], params使用键值对[key=value]表示
%           刷：\path[fill, params] = \fill [params], params使用键值对[key=value]表示
%           线：--, .., -|, |-
%           形：circle, ellipse, rectangle, arc, grid, parabola, sin, cos, svg, plot ...
\RequirePackage{
    tikz, % 绘图
    graphicx, % 图片包
}
\usetikzlibrary{
    arrows, % 箭头形状
    arrows.meta, % 箭头形状
    calc, % 坐标计算
    positioning, % Node位置
    scopes,
    shapes,
    shadows,
}
\pgfdeclarelayer{fg} % 背景图层
\pgfdeclarelayer{bg} % 前景图层
\pgfsetlayers{bg, main, fg} % 图层顺序

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 公式
\RequirePackage{
    mathtools, % 数学工具
    bm, % 数学公式中用的粗体
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 代码块
\RequirePackage{
    listings, % 源代码显示
}
\lstset{
    backgroundcolor=\color[gray]{0.95},
    breaklines=true,
    numbers=left,
    numbersep=3pt,
    basicstyle=\ttfamily\footnotesize,
    numberstyle=\scriptsize\color[gray]{0.5},
    keywordstyle=\color{magenta},
    stringstyle=\color[rgb]{0.72, 0.73, 0.14},
    commentstyle=\color[rgb]{0.0, 0.5, 0.0},
}
